package com.wit.zhenghao.day09;

public class GenericClassMethod {

	public static void main(String[] args) {
		System.out.println(max(4,8,74,23));
		System.out.println(max(1.0,5.9,3.7,7.8));
	}
	
	public static <T extends Number> T max(T... num) {
		if(num.length == 0) {
			throw new RuntimeException("参数不能为空。。。");
		}
		T max = num[0];
		for(int i = 1;i < num.length;i++) {
			if(num[i].doubleValue() > max.doubleValue()) {
				max = num[i];
			}
		}
		return max;
	}
}
